<?php
namespace Home\Model;
use Think\Model;

/**
* 
*/
class ActivityModel extends Model
{
	function activitylist($userid,$id=0)
  {
    $where = 'c.uid='.$userid;
    if($id)
    {
      $where .= ' and a.id='.$id;
    }
    $result = $this->field('a.*,s.name as shopname,s.address,s.tel')
              ->where($where)->table('am_activity as a')
              ->join('left join am_activity_joins as c on c.act_id=a.id')
              ->join('left join am_shop as s on s.id=c.shop_id')
              ->select();
    return $result;
  }

}